<template>
    <view class="main">
        <view class="btn-wrap" @click="select(1)"><button type="primary">1号地磅</button></view>
        <view class="btn-wrap" @click="select(2)"><button type="primary">2号地磅</button></view>
        <view class="btn-wrap" @click="select(3)"><button type="primary">3号地磅</button></view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            height: 0,
            status: 'loading',
            loadText: {
                loadmore: '上拉加载更多',
                loading: '加载中...',
                nomore: '没有更多数据了'
            }
        };
    },
    onShow() {
        //
    },
    mounted() {
        const query = uni.createSelectorQuery();
        query
            .in(this)
            .select('.main')
            .boundingClientRect();
        query.exec(res => {
            this.height = uni.getSystemInfoSync().windowHeight - res[0].top - uni.upx2px(160);
        });
    },
    methods: {
        select(num) {
            console.log(num);
            this.$store.state.MQTT_NUMBER = num;
            uni.showToast({
                title: "设置成功",
                icon: "none",
                duration: 1000
            })
        }
    }
};
</script>

<style>
.btn-wrap {
    width: 600rpx;
    height: 80rpx;
    margin: 0 auto;
    margin-top: 40rpx;
}
</style>
